<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
 <meta name="renderer" content="webkit">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>项目详细信息</title>
<jsp:include page="../../import.jsp" flush="true" />
</head>
<body class="iframeBody">
    <div class="Wrapper">
        <div>
            <div id="pageInTab" class="pageInTab">
                <div tabid="tabA" title="基本信息" lselected="true">
                    <form id="formSet1">
                        <div class="fieldset1 tabel_col clearFix">
                            <div class="caption">
                                <span class="title">基本信息</span>
                            </div>
                            <!-- div class="fieldBox col_33">
                                <div class="label">项目类型</div>
                                <div class="field">
                                     <span id="prjTypCdNm" name="prjTypCdNm">&nbsp;</span>
                                </div>
                            </div-->
                           
                           
                            <div class="fieldBox col_33">
                            <div class="label">合同签署方式</div>
                            <div class="field">
                                    <span id="cntTypCdNm" name="cntTypCdNm">&nbsp;</span>
                                
                            </div>
                       		 </div>
                            <div class="fieldBox col_33">
                                <div class="label">区域-省</div>
                                <div class="field">
                                   
	                               <input name="rgnProvCd" id="rgnProvCd" data-value=" " placeholder="--请选择--" ltype="combobox" >
									
                                </div>
                            </div>
                            <div class="fieldBox col_33">
                                <div class="label">区域-市</div>
                                <div class="field">
                                  <input name="rgnCityCd" id="rgnCityCd" data-value=" " placeholder="--请选择--" ltype="combobox" >
									
                                </div>
                            </div>
                            
                            <div class="fieldBox col_33" id="cstNmDiv" >
	                            <div class="label">客户名称</div>
	                            <div class="field">
	                                  <span name="cstNm" id="cstNm">&nbsp;</span>
	                               
	                            </div>
	                        </div>
	                        
	                        <div class="fieldBox col_33" id="rskLvlCdNmDiv" >
	                            <div class="label">征信评级</div>
	                            <div class="field">
	                                  <span name="rskLvlCdNm" id="rskLvlCdNm">&nbsp;</span>
	                               
	                            </div>
	                        </div>
                        
                            <div class="fieldBox col_100" style="display:none;">
								<div class="field">
								    <input name=prjId id="prjId" type="text" class="ui-textbox" value="${id}">
								</div>
							</div>
                        </div>
                    </form>
                </div>
	                <div tabid="tabB" title="项目产品" id="tabBId" style="display: none;">
	                <iframe frameborder="0" name="tabB" id="tabB" src=""></iframe>
		            </div>
		            <div tabid="tabC" title="资信信息" id="tabCId" style="display: none;" prjId="" cstId="">
		                <iframe frameborder="0" name="tabC" id="tabC" src="" prjId="" cstId=""></iframe>
		            </div>
		
		            <!--   <div tabid="tabD" title="担保人资信信息" id="tabDId" style="display: none;" prjId="" cstId="">
		             	 <iframe frameborder="0" name="tabD" id="tabD" src="" prjId="" cstId=""></iframe>
		             </div> 
		            <div tabid="tabE" title="报价方案" id="tabEId" style="display: none;">
		                <iframe frameborder="0" name="tabE" id="tabE" src=""></iframe>
		            </div>
		            <div tabid="tabG" title="产品明细" id="tabGId" style="display: none;">
		                <iframe frameborder="0" name="tabG" id="tabG" src=""></iframe>
		            </div>
		            
		            <div tabid="tabN" title="保险分期" id="tabNId" style="display: none;">
		                <iframe frameborder="0" name="tabN" id="tabN" src=""></iframe>
		            </div>
		            -->
		            <div tabid="tabF" title="支付表" id="tabFId" style="display: none;">
		                <iframe frameborder="0" name="tabF" id="tabF" src=""></iframe>
		            </div>
		            
		            <div tabid="tabK" title="项目资料" id="tabKId" style="display: none;">
		                <iframe frameborder="0" name="tabK" id="tabK" src=""></iframe>
		            </div>
		            <div tabid="tabL" title="合同信息" id="tabLId" style="display: none;">
		                <iframe frameborder="0" name="tabL" id="tabL" src=""></iframe>
		            </div>
		            
            </div>
        </div>
    </div>

<script type="text/javascript">
$(function () {
	initData();
	initTab();
	$("#rgnProvCd").ligerComboBox({
		valueField: 'key',
		textField: 'value',
		width:150,
		onChangeValue:function(value){
			if(value){
				initRegionCitySelectData(value);
			}else{
				var citySelectObj = liger.get("rgnCityCd");
				citySelectObj.selectValue(" ");
			}
		}
	});
	$("#rgnCityCd").ligerComboBox({
		valueField: 'key',
		textField: 'value',
		width:150,
		onChangeValue:function(value){
			if(value){
			}else{
				var countySelectObj = liger.get("rgnCountyCd");
				countySelectObj.selectValue(" ");
			}
		}
	});
	
	
});
	//初始化数据
	function initData(){
		var prjId = $("#prjId").val();
    	if(!prjId)return;
    	var _url = '<%=path%>/project/prjbscinfo/getById.do';
    	$.ajax({
    		type: 'get',
    		dataType:'json',
    		data:{id:prjId, pian:"101"}, //添加外部机构标识
    		url: _url,
    		success:function(msg){
    			 if(msg.success == 1){
    				 setData(msg.data);//设置数据
    			 }else{
    				 top.$.ligerDialog.SQalert({content: msg.info,SQ_type: "error"});
    			 }
    		}
    	});
	}
	var _rgnProvCdUpdataValue="";
	var _rgnCityCdUpdataValue="";
	//设置页面数据
    function setData(data){
    	$("#prjTypCdNm").html(data.prjTypCdNm);
    	$("#certNo").html(data.certNo);
    	$("#cstNm").html(data.cstNm);
    	$("#rskLvlCdNm").html(data.rskLvlCdNm); //征信评级（仅用于显示）
    	$("#prjNm").html(data.prjNm);
    	$("#cntTypCdNm").html(data.cntTypCdNm);
    	_rgnProvCdUpdataValue=data.rgnPrCd;
    	_rgnCityCdUpdataValue=data.rgnCyCd;
    	initRegionProvSelectData();
    	initRegionCitySelectData(data.rgnPrCd);
    	liger.get("rgnProvCd").setDisabled(true);
    	liger.get("rgnCityCd").setDisabled(true);
	};

	//获取区域下拉框选中值
	function getRgnProvCd(){ //省
		var provSelectObj = liger.get("rgnProvCd");
		var _provCd = provSelectObj.getValue();
		return _provCd;
	}
	function getRgnCityCd(){ //市
		var citySelectObj = liger.get("rgnCityCd");
		var _cityCd = citySelectObj.getValue();
		return _cityCd;
	}
	//初始化省级数据
	function initRegionProvSelectData(){
		$.ajax({
			type: 'post',
			dataType:'json',
			url: '<%=path%>/system/sysRegion/getProvinceRegion.do',
			success:function(msg){
				 if(msg.success == 1){
					 var provSelectObj = liger.get("rgnProvCd");
					 provSelectObj.setData(msg.data);
					 if(StringUtils.isNotEmpty(_rgnProvCdUpdataValue)){
						 provSelectObj.selectValue(_rgnProvCdUpdataValue);
					 }else{
						 //provSelectObj.selectValue(msg.data[0].key);
					 }
				 }else{
					 $.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
				 }
			}
		});
	}

	//初始化市级数据(value:省代码)
	function initRegionCitySelectData(value){
		if(!$("#rgnCityCd").length)return;
		var provSelectObj = liger.get("rgnProvCd");
		var _provCd = provSelectObj.findValueByText(value);
		if(!_provCd){
			return;
		}
		$.ajax({
			type: 'post',
			dataType:'json',
			data:{rgnCd:_provCd},
			url: '<%=path%>/system/sysRegion/getRegionByRgnCd.do',
			success:function(msg){
				 if(msg.success == 1){
					 var citySelectObj = liger.get("rgnCityCd");
					 if(msg.data){
						 citySelectObj.setData(msg.data);
						 if(StringUtils.isNotEmpty(_rgnCityCdUpdataValue)){
							 citySelectObj.selectValue(_rgnCityCdUpdataValue);
						 }else{
							 //citySelectObj.selectValue(msg.data[0].key);
						 }
					 }else{
						 citySelectObj.clear();
						 citySelectObj.setData({});//置空下拉框数据
						 var countySelectObj = liger.get("rgnCountyCd");
						 if(countySelectObj){
							 countySelectObj.clear();
							 countySelectObj.setData({});//置空下拉框数据
						 }
					 }
				 }else{
					 $.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
				 }
			}
		});
	}
	
	
	
	
	//初始化Tab
	var pageInTab = null;
   var pageInApp = {};
   var loadedTabs = [];
function initTab(){
	 pageInTab = $("#pageInTab").ligerTab({
        height: 'auto',
        contextmenu: false,
        minIframeHeight: GET_minIframeHeight(),
       
        onAfterSelectTabItem: function(tabid) {
                loadedTabs.push(tabid);
                var detailFlag="true";
                var flowParms="";
                var prjId=${id};
                var contractNo='${contractNo}';
                switch (tabid){
                    case "tabA":
                   
                   	 pageInTab.setTabItemSrc(tabid, "<%=path%>/project/prjbscinfo/toProtBacInfoDetailPage.do?pianflag=101&id=${id}");
                        break;  
                    case "tabB":
                        pageInTab.setTabItemSrc(tabid, "<%=path%>/project/prjbscinfo/toPrjPrdListPage.do?pianflag=101&&id=${id}&&detailFlag=" + detailFlag + flowParms);
                        break;
                    case "tabC":
                        pageInTab.setTabItemSrc(tabid, "<%=path%>/project/prjbscinfo/toPrjDetailInvestRptPage.do?pianflag=101&&prjId=" + prjId + "&&detailFlag=" + detailFlag + "&&cstRlCd=" + "1");
                        
                        $("#tabCId").attr("prjId", prjId);
                        $("#tabCId").attr("detailFlag", detailFlag);
                        $("#tabCId").attr("cstRlCd", "1");
                        break;
                   
                    case "tabF":
                        pageInTab.setTabItemSrc(tabid, "<%=path%>/project/prjprdpayschm/toListPage.do?pianflag=101&contractNo="+contractNo+"&prjId=" + prjId + "&detailFlag=" + detailFlag + flowParms);
                        break;
                 
                    case "tabK":
                        pageInTab.setTabItemSrc(tabid, "<%=path%>/project/prjFileInfo/toFileInfoListPage.do?pianflag=101&&prjId=" + prjId + "&&detailFlag=" + detailFlag + flowParms);
                        break;
                    case "tabL":
                        pageInTab.setTabItemSrc(tabid, "<%=path%>/project/cont/toListPage.do?pianflag=101&&prjId=" + prjId + "&&detailFlag=" + detailFlag + flowParms);
                        break;
                  //  case "tabM":
                  //  	pageInTab.setTabItemSrc(tabid, "<%=path%>/project/prjBscInfoInsDistribute/toPrjBscInsEditPage.do?prjId=" + prjId + "&&detailFlag=" + detailFlag );
                  //  	break;
                  //  case "tabN":
                   // 	pageInTab.setTabItemSrc(tabid, "<%=path%>/inscare/insapplication/toInsuranceTabPage.do?prjId=" + prjId + "&&detailFlag=" + detailFlag );
                  //  	break; 
                }
      
            SetIframe_height();
        }
    });

    $.extend(true, pageInApp, {
        pageInTab: pageInTab
    });
}
    </script>
</body>
</html>